<?php
/**
 * Zone.php
 *
 * @copyright   2023 thingsworld.com.cn - All Rights Reserved
 * @link        http://thingsworld.com.cn/
 * @author      stiffer.chen <chenl@thingsworld.com.cn>
 * @created     2023-03-14 17:45:14
 * @modified    2023-03-14 17:45:14
 *
 */

namespace App\Models\Dept;

use App\Models\BaseModel;
use App\Models\DeptModel;

class Zone extends BaseModel
{
    protected $table = 'dept_zone';

    protected $fillable = [
        'dept_id',
        'city_id'
    ];

    public function scopeByProvinceId($query, $provinceId)
    {
        return $query->where('city_id', $provinceId);
    }

    public function dept()
    {
        return $this->belongsTo(DeptModel::class, 'dept_id');
    }
}